cmake_minimum_required(VERSION 3.0)
project(freecraft)

MESSAGE(STATUS "operation system is ${CMAKE_SYSTEM}")
IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
    MESSAGE(STATUS "current platform: Linux ")
    add_definitions(-D TARGET_LINUX)
    cmake_policy(SET CMP0072 NEW)
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
    MESSAGE(STATUS "current platform: Windows")
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
    MESSAGE(STATUS "current platform: FreeBSD")
ELSE ()
    MESSAGE(STATUS "other platform: ${CMAKE_SYSTEM_NAME}")
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux")

find_package(OpenGL REQUIRED)

if( CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR )
    message( FATAL_ERROR "Please select another Build Directory ! (and give it a clever name, like bin_Visual2012_64bits/)" )
endif()
if( CMAKE_SOURCE_DIR MATCHES " " )
    message( "Your Source Directory contains spaces. If you experience problems when compiling, this can be the cause." )
endif()
if( CMAKE_BINARY_DIR MATCHES " " )
    message( "Your Build Directory contains spaces. If you experience problems when compiling, this can be the cause." )
endif()

add_subdirectory(test)
add_subdirectory(thirdparty)


include_directories(
    thirdparty/glm-0.9.9.2/
    # thirdparty/freeglut-3.0.0/include
    thirdparty/glew-2.1.0/include
    thirdparty/stb/
    ${GLFW_INCLUDE_DIR}
    # ${ZLIB_INCLUDE_DIR}
    # ${PNG_INCLUDE_DIR}
    thirdparty/freetype-2.10.0/include
)

set(ALL_LIBS
    ${OPENGL_LIBRARY}
    GLEW_210
    # zlibstatic
    # png_static
    glfw
)

add_subdirectory(freecraft)
